<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>缤格</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/swiper.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/common.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/binge.css"/>
    <script type="text/javascript" src="../../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../../script/swiper.min.js"></script>
    <script type="text/javascript" src="../../script/mobile.js"></script>
    <script type="text/javascript">
        window['adaptive'].desinWidth = 750;
        window['adaptive'].baseFont = 28;
        window['adaptive'].maxWidth = 750;
        window['adaptive'].init();
    </script>
</head>

<body>
<!-- header -->
<div id="header" style="height: 0.9rem; background: #fff; position: fixed; top: 0;left: 0; width: 100%; z-index: 99">
    <div class="header">
        <div class="head-back">
            <a href="javascript:void(0);" tapmode onclick="comeBack()" class="back-btn"></a>
        </div>
        <div class="head-title">
            <h6>搜索结果</h6>
        </div>
        <!--<div class="head-action">-->
        <!--<a href="javascript:void(0);" tapmode class="action-btn"></a>-->
        <!--</div>-->
    </div>
</div>
<!-- header end -->

<div class="mescroll" id="mescroll" style="padding-top: 1.6rem">

    <div class="result-kinds">
        <ul>
            <li class="on" data-type="1">新闻</li>
            <li data-type="2">话题</li>
            <li data-type="3">帖子</li>
            <li data-type="4">活动</li>
            <li data-type="5">用户</li>
        </ul>
    </div>

    <div class="result-section">

        <div class="result-view" style="display: block;">
            <div class="index-news">
                <ul id="newsContent">
                    <!--新闻-->
                </ul>
            </div>
        </div>
        <div class="result-view" style="display: none;">
            <div class="topic-list">
                <ul id="discussContent">
                    <!--话题-->
                    <!--<li tapmode onclick="commonUrl('topic_detail')">
                        <div class="topic-before-title">
                            <h6 class="topic-title single-ellipsis">压力是否越大越好压力？</h6>
                            <span class="time">2019.09.25</span>
                        </div>
                        <p class="topic-num">22456人已参与</p>
                        <div class="topic-vote">
                            <span class="vote choose1" tapmode onclick="choose(1,event)">学历</span>
                            <span class="vote choose2" tapmode onclick="choose(2,event)">经历</span>
                        </div>
                        <div class="choose-result">
                            <div class="result1 result">
                                <div class="result-txt"><span class="icon">学历</span></div>
                                <div class="bar-line">
                                    <div class="line" style="width: 70%;"></div>
                                </div>
                                <div class="percentage">70%</div>
                            </div>
                            <div class="result2 result">
                                <div class="result-txt"><span class="icon">经历</span></div>
                                <div class="bar-line">
                                    <div class="line" style="width: 30%;"></div>
                                </div>
                                <div class="percentage">30%</div>
                            </div>
                        </div>
                    </li>-->

                </ul>
            </div>
        </div>
        <div class="result-view" style="display: none;">
            <div class="index-news user-dynamic">
                <ul id="inviteContent">
                    <!--帖子-->
                </ul>
            </div>
        </div>
        <div class="result-view" style="display: block;">
            <div class="activity-list">
                <ul id="actContent">
                    <!--活动-->
                    <!--<li class="list-li" onclick="commonUrl()" tapmode>
                        <div class="flex-div">
                            <div class="act-img bg-cover"
                                 style="background-image: url('../../image/img-activity.png')"></div>
                            <div class="act-info">
                                <h6 class="single-ellipsis">音乐爱好者，一起为音乐疯狂起来</h6>
                                <div class="act-time">
                                    <p class="time">周日 09/29 14:00</p>
                                    <p class="status status1">报名中</p>
                                </div>
                                <div class="act-place">
                                    <p class="place">重庆大学城</p>
                                    <p class="num">9/10</p>
                                </div>
                            </div>
                        </div>
                        <div class="detail-bottom">
                            <div class="bottom-tips">
                                <span class="bt-pd toUp">精选</span>
                                <span class="bt-pd tips">#读书会#</span>
                                <div class="bottom-hot">3.3w</div>
                            </div>
                        </div>
                    </li>-->

                </ul>
            </div>
        </div>
        <div class="result-view" style="display: none;">
            <div class="love-list area">
                <ul id="userContent">
                    <!--用户-->
                    <!--<li>
                        <div class="common-user-detail">
                            <div class="user-info">
                                <div class="user-icon bg-cover"
                                     style="background-image: url('../../image/img-tx.png');"></div>
                                <div class="info">
                                    <div class="name">
                                        <h6>后来熟悉</h6>
                                        <dl class="badge-list">
                                            <dd class="icon"><img src="../../icon/icon-hz01.png" alt=""></dd>
                                            <dd class="icon"><img src="../../icon/icon-hz02.png" alt=""></dd>
                                            <dd class="icon"><img src="../../icon/icon-hz03.png" alt=""></dd>
                                            <dd class="icon"><img src="../../icon/icon-hz04.png" alt=""></dd>
                                            <dd class="icon"><img src="../../icon/icon-hz05.png" alt=""></dd>
                                        </dl>
                                    </div>
                                    <span class="time single-ellipsis">无拘无束，自由自在自由自在自由自在自由自在自由自在自由自在</span>
                                </div>
                            </div>
                        </div>
                    </li>-->
                </ul>
            </div>
        </div>
    </div>

</div>


</body>

</html>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<link rel="stylesheet" type="text/css" href="../../css/mescroll.min.css"/>
<script type="text/javascript" src="../../script/mescroll.min.js"></script>
<script type="text/javascript">
    var key = '';//搜索内容
    var type = 1;//类型：1新闻 2话题 3帖子 4活动 5用户
    var page = 1;
    var pullUp = false;
    apiready = function () {

        setFixStatusBar(); //设置状态栏
        pop.loading();
        keybackListener()
        getSearchResult()

        SystemCheckVersion()

    }

    //创建MeScroll对象
    var mescroll = new MeScroll("mescroll", {
        down: {
            auto: false, //是否在初始化完毕之后自动执行下拉回调callback; 默认true
            callback: downCallback //下拉刷新的回调
        },
        up: {
            auto: false, //是否在初始化时以上拉加载的方式自动加载第一页数据; 默认false
            isBounce: false, //此处禁止ios回弹,解析(务必认真阅读,特别是最后一点): http://www.mescroll.com/qa.html#q10
            callback: upCallback, //上拉回调,此处可简写; 相当于 callback: function (page) { upCallback(page); }
            /*toTop:{ //配置回到顶部按钮
                src : "../res/img/mescroll-totop.png", //默认滚动到1000px显示,可配置offset修改
                //offset : 1000
            }*/
        }
    });
    /*下拉刷新的回调 */
    function downCallback() {
        page = 1;
        getSearchResult()

        //mescroll.endErr();
    }
    /*上拉加载的回调 */
    function upCallback() {
        if (pullUp == true) {
            getSearchResult()
        }else {
            mescroll.endErr();
        }
    }



    //获取搜索关键词记录展示，热门搜索
    function getSearchResult() {
        var key = api.pageParam.key;
        // var key = '生活费';
        var param = {
            token: $api.getStorage('token'),
            key: key,
            type: type,//类型：1新闻 2话题 3帖子 4活动 5用户
            page: page
        }
        getAjax(Interface.search, param, function (res) {

            var listData = res.data.list;

            if (isDefine(listData)) {

                if (type == 1) {
                    //新闻
                    var newsHtml = '';

                    for (var i = 0; i < listData.length; i++) {
                        var list = listData[i];
                        var toUp = '';//是否置顶
                        var hotHtml = '';//热度，标签
                        var titleHtml = '';//主体内容
                        if (list.recommend == 1) {
                            toUp = '<span class="bt-pd toUp">置顶</span>';
                        }
                        var shield = '<div class="line_center" style="justify-content: space-between;">' +
                            '                                <div class="shield">' +
                            '                                    <span tapmode onclick=\'jubao('+list.id+',event,1)\'>举报</span>' +
                            '                                    <span tapmode onclick=\'shield('+list.id+',event,1,this)\'>屏蔽</span>' +
                            '                                </div>' +
                            '                                <div class="bottom-hot">' + list.hot_number + '</div>' +
                            '                            </div>';

                        var news_label = '';
                        if (isDefine(list.news_label_name)) {
                            $.each(list.news_label_name,function (k, ktem) {
                                if(k<3){
                                    news_label += '<span class="bt-pd tips" onclick=\'commonUrl("../index/news_list",{tips_id:' + ktem.id + '})\'>#' + ktem.title + '#</span>';
                                }
                            });
                        }
                        hotHtml = '<div class="detail-bottom">' +
                            '              <div class="bottom-tips">' + toUp + news_label + '</div>' + shield +
                            '          </div>';

                        //顶置，标签，热度
                        /*hotHtml = '<div class="detail-bottom">' +
                            '              <div class="bottom-tips">' + toUp +
                            '                  <span class="bt-pd tips">#' + list.news_label_name + '#</span>' +
                            '                  <span class="bt-pd time">' + list.date + '</span>' +
                            '              </div>' +
                            '              <div class="bottom-hot">' + list.hot_number + '</div>' +
                            '          </div>';*/

                        if (isDefine(list.void_path)) {

                            //视频新闻
                            titleHtml = '<div class="video-detail">' +
                                '             <h6 class="news-title multiline-ellipsis">' + list.title + '</h6>' +
                                '             <div class="video-box bg-cover" style="background-image: url(' + ajaxUrl + list.void_icon_path + ')";>' +
                                '                 <p class="single-ellipsis"></p>' +
                                '                 <span class="icon-play"></span>' +
                                '                 <span class="time"></span>' +
                                '              </div>' + hotHtml +
                                '         </div>';

                        } else {
                            //三张图片新闻
                            if (list.icon_path.length >= 3) {
                                titleHtml = '<div class="video-detail">' +
                                    '            <h6 class="news-title multiline-ellipsis">' + list.title + '</h6>' +
                                    '            <div class="detail-img-list">' +
                                    '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list.icon_path[0] + ');"></div>' +
                                    '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list.icon_path[1] + ');"></div>' +
                                    '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list.icon_path[2] + ');"></div>' +
                                    '            </div>' + hotHtml +
                                    '        </div>'
                            } else if (list.icon_path.length == 2) {
                                //两张图片新闻
                                titleHtml = '<div class="video-detail">' +
                                    '            <h6 class="news-title multiline-ellipsis">' + list.title + '</h6>' +
                                    '            <div class="detail-img-list two-img">' +
                                    '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list.icon_path[0] + ');"></div>' +
                                    '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list.icon_path[1] + ');"></div>' +
                                    '            </div>' + hotHtml +
                                    '        </div>'
                            } else if (list.icon_path.length == 1) {
                                //单张图片新闻




                                news_label = '';
                                if (isDefine(list.news_label_name)) {
                                    $.each(list.news_label_name,function (k, ktem) {
                                        if(k<2){
                                            news_label += '<span class="bt-pd tips" onclick=\'commonUrl("../index/news_list",{tips_id:' + ktem.id + '})\'>#' + ktem.title + '#</span>';
                                        }
                                    });
                                }
                                hotHtml = '<div class="detail-bottom">' +
                                    '              <div class="bottom-tips">' + toUp + news_label + '</div>' + shield +
                                    '          </div>';


                                titleHtml = '<div class="single-news">' +
                                    '             <div class="detail-img-list">' +
                                    '                 <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list.icon_path[0] + ');"></div>' +
                                    '             </div>' +
                                    '             <div class="video-detail">' +
                                    '                 <h6 class="news-title multiline-ellipsis_3">' + list.title + '</h6>' + hotHtml +
                                    // '                 <p class="detail-info multiline-ellipsis">' + list.brief + '</p>' + hotHtml +
                                    '             </div>' +
                                    '         </div>';
                            }
                        }
                        var formdata;
                        var url;
                        if(isDefine(list.url)){
                            formdata = {"url": list.url,"news_id": list.id};
                            url = '../index/banner_detail';
                        }else {
                            formdata = {"news_id": list.id};
                            url = "../index/news_detail";
                        }
                        newsHtml += '<li tapmode onclick=\'commonUrl("'+url+'",' + jsonChange(formdata) + ')\'>' + titleHtml + '</li>';

                    }

                    if (page == 1) {
                        $('#newsContent').html(newsHtml)
                    } else {
                        $('#newsContent').append(newsHtml)
                    }


                } else if (type == 2) {
                    //话题
                    var discussHtml = '';
                    console.log(jsonChange(listData))
                    for (var i = 0; i < listData.length; i++) {
                        var list = listData[i];
                        var result = '';
                        var param = {"discuss_id": list.id, "today": 2};
                        if(list.over_status == 1){

                            if (isDefine(list.so)) {
                                if (list.so == 1) {
                                    result = '<div class="choose-result" style="display: block;"><div class="result1 result">' +
                                        '                    <div class="result-txt"><span class="icon">支持</span></div>' +
                                        '                    <div class="bar-line">' +
                                        '                         <div class="line" style="width: ' + list.rate + '%; background: #7dcec8"></div>' +
                                        '                    </div>' +
                                        '                    <div class="percentage" style="color: #7dcec8">' + list.rate + '%</div>' +
                                        '</div></div>';
                                } else {
                                    result = '<div class="choose-result" style="display: block;"><div class="result2 result">' +
                                        '                    <div class="result-txt"><span class="icon">反对</span></div>' +
                                        '                    <div class="bar-line">' +
                                        '                         <div class="line" style="width: ' + list.rate + '%; background: #fe7678"></div>' +
                                        '                    </div>' +
                                        '                    <div class="percentage" style="color: #fe7678">' + list.rate + '%</div>' +
                                        '</div></div>';
                                }
                                discussHtml += '<li tapmode onclick=\'commonUrl("topic_detail",' + jsonChange(param) + ')\'>' +
                                    '                    <h6 class="topic-title multiline-ellipsis">' + list.title + '</h6>' +
                                    '                    <p class="topic-num">' + list.count + '人已参与 <span>截止时间：'+list.over_time+'</span></p>' + result + '</li>';

                            } else {
                                discussHtml += '<li tapmode onclick=\'commonUrl("topic_detail",' + jsonChange(param) + ')\'>' +
                                    '                    <h6 class="topic-title multiline-ellipsis">' + list.title + '</h6>' +
                                    '                    <p class="topic-num">' + list.count + '人已参与<span>截止时间：'+list.over_time+'</span></p>' +
                                    '                    <div class="topic-vote" data-num="' + list.count + '">' +
                                    '                        <span class="vote choose1" tapmode onclick="choose(' + list.id + ',1,event,this)">支持</span>' +
                                    '                        <span class="vote choose2" tapmode onclick="choose(' + list.id + ',0,event,this)">反对</span>' +
                                    '                    </div>' +
                                    '                    <div class="choose-result">' +
                                    '                        <div class="result1 result">' +
                                    '                            <div class="result-txt"><span class="icon">支持</span></div>' +
                                    '                            <div class="bar-line">' +
                                    '                                <div class="line" style="width: ' + list.rate + '%; background: #7dcec8"></div>' +
                                    '                            </div>' +
                                    '                            <div class="percentage" style="color: #7dcec8">' + list.rate + '%</div>' +
                                    '                        </div>' +
                                    '                        <div class="result2 result">' +
                                    '                            <div class="result-txt"><span class="icon">反对</span></div>' +
                                    '                            <div class="bar-line">' +
                                    '                                <div class="line" style="width: ' + list.rate + '%; background: #fe7678"></div>' +
                                    '                            </div>' +
                                    '                            <div class="percentage" style="color: #fe7678">' + list.rate + '%</div>' +
                                    '                        </div>' +
                                    '                    </div></li>'
                            }

                        }else {
                            result = '<div class="choose-result" style="display: block">' +
                                '                        <div class="time-over result">' +
                                '                            <div class="result-txt just-status"><span class="icon">'+list.just_title+'</span></div>' +
                                '                            <div class="result-line">' +
                                '                                <div class="result-percentage">' +
                                '                                    <div class="just-num">'+list.just_rate+'%</div>' +
                                '                                    <div class="back-num">'+list.back_rate+'%</div>' +
                                '                                </div>' +
                                '                                <div class="bar-line">' +
                                '                                    <div class="line line-just" style="width: ' + list.just_rate + '%;"></div>' +
                                '                                    <div class="line line-back" style="width: ' + list.back_rate + '%;"></div>' +
                                '                                </div>' +
                                '                            </div>' +
                                '                            <div class="result-txt back-status"><span class="icon">'+list.back_title+'</span></div>' +
                                '                        </div>' +
                                '                    </div>';

                            discussHtml += '<li tapmode onclick=\'commonUrl("topic_detail",' + jsonChange(param) + ')\'>' +
                                '                    <div class="topic-before-title">' +
                                '                       <h6 class="topic-title multiline-ellipsis">' + list.title + '</h6>' +
                                '                       <span class="time">'+list.create_time+'</span>' +
                                '                    </div>' +
                                '                    <p class="topic-num">' + list.count + '人已参与 <span>截止时间：'+list.over_time+'</span></p>' + result + '</li>'
                        }

                    }


                    if (page == 1) {
                        $('#discussContent').html(discussHtml)
                    } else {
                        $('#discussContent').append(discussHtml)
                    }


                } else if (type == 3) {
                    //帖子

                    var inviteHtml = '';
                    for (var i = 0; i < listData.length; i++) {
                        var list = listData[i];
                        var userData = list.member;
                        var userInfo = '';
                        var follow = '';//是否关注
                        var badgeList = '';//徽章列表
                        var toUp = '';//是否置顶
                        var hotHtml = '';//热度，标签
                        var titleHtml = '';//主体内容
                        if (list.recommend == 1) {
                            toUp = '<span class="bt-pd toUp">置顶</span>';
                        }
                        //顶置，标签，热度
                        hotHtml = '<div class="detail-bottom">' +
                            '              <div class="bottom-tips">' + toUp +
                            '                  <span class="bt-pd tips">#' + list.circle_title + '#</span>' +
                            '                  <span class="bt-pd time">' + list.date + '</span>' +
                            '              </div>' +
                            '              <div class="bottom-hot">' + list.hot_number + '</div>' +
                            '          </div>';


                        if (list.member_follow != 1) {
                            follow = '<div class="follow" tapmode onclick="followAction(1,' + userData.id + ')">' +
                                '         <span class="no-follow">关注</span>' +
                                '     </div>'
                        } else {
                            follow = '<div class="follow on" tapmode onclick="followAction(2,' + userData.id + ')">' +
                                '         <span class="followed">已关注</span>' +
                                '     </div>'
                        }
                        if (isDefine(userData.badge_path)) {
                            for (var k = 0; k < userData.badge_path.length; k++) {
                                if (k <= 5) {
                                    badgeList += '<dd class="icon"><img src="' + ajaxUrl + userData.badge_path[k] + '" alt=""></dd>'
                                }
                            }
                        }


                        var user = {'member_id': userData.id};
                        var invitation_id = {'invitation_id': list.id};
                        userInfo = '<div class="common-user-detail">' +
                            '           <div class="user-info" tapmode onclick=\'commonUrl("../activity/person_index",' + jsonChange(user) + ')\'>' +
                            '               <div class="user-icon bg-cover" style="background-image: url(' + ajaxUrl + userData.icon_path + ');"></div>' +
                            '               <div class="info">' +
                            '                    <div class="name">' +
                            '                        <h6>' + userData.name + '</h6>' +
                            '                        <dl class="badge-list" tapmode onclick="toBadgePage(event)">' + badgeList + '</dl>' +
                            '                    </div>' +
                            '                    <span class="time">' + list.date + '</span>' +
                            '                </div>' +
                            '            </div>' + follow + '</div>';

                        if (isDefine(list.void_path)) {
                            //视频帖子
                            titleHtml = '<div class="video-detail" tapmode onclick=\'commonUrl("../circle/invite_detail",' + jsonChange(invitation_id) + ')\'>' +
                                '             <h6 class="news-title multiline-ellipsis">' + list.title + '</h6>' +
                                '             <div class="video-box bg-cover" style="background-image: url(' + ajaxUrl + list.void_icon_path + ')";>' +
                                '                 <p class="single-ellipsis"></p>' +
                                '                 <span class="icon-play"></span>' +
                                '                 <span class="time"></span>' +
                                '              </div>' + hotHtml +
                                '         </div>';

                        } else {
                            if (isDefine(list.icons_path)) {
                                //三张图片帖子
                                if (list.icons_path.length >= 3) {
                                    titleHtml = '<div class="video-detail" tapmode onclick=\'commonUrl("../circle/invite_detail",' + jsonChange(invitation_id) + ')\'>' +
                                        '            <h6 class="news-title multiline-ellipsis">' + list.title + '</h6>' +
                                        '            <div class="detail-img-list">' +
                                        '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list.icons_path[0] + ');"></div>' +
                                        '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list.icons_path[1] + ');"></div>' +
                                        '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list.icons_path[2] + ');"></div>' +
                                        '            </div>' + hotHtml +
                                        '        </div>'
                                } else if (list.icons_path.length == 2) {
                                    //两张图片帖子
                                    titleHtml = '<div class="video-detail" tapmode onclick=\'commonUrl("../circle/invite_detail",' + jsonChange(invitation_id) + ')\'>' +
                                        '            <h6 class="news-title multiline-ellipsis">' + list.title + '</h6>' +
                                        '            <div class="detail-img-list two-img">' +
                                        '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list.icons_path[0] + ');"></div>' +
                                        '                <div class="img bg-cover" style="background-image: url(' + ajaxUrl + list.icons_path[1] + ');"></div>' +
                                        '            </div>' + hotHtml +
                                        '        </div>'
                                } else if (list.icons_path.length == 1) {
                                    //单张图片帖子
                                    titleHtml = '<div class="video-detail" tapmode onclick=\'commonUrl("../circle/invite_detail",' + jsonChange(invitation_id) + ')\'>' +
                                        '              <h6 class="news-title multiline-ellipsis_3">' + list.title + '</h6>' +
                                        '              <div class="video-box bg-cover" style="background-image: url(' + ajaxUrl + list.icons_path[0] + ')" ;></div>' + hotHtml + '</div>';
                                }
                            } else {
                                //无图
                                titleHtml += '<div class="video-detail" tapmode onclick=\'commonUrl("../circle/invite_detail",' + jsonChange(invitation_id) + ')\'>' +
                                    '            <h6 class="news-title multiline-ellipsis">' + list.title + '</h6>' + hotHtml +
                                    '        </div>'

                            }


                        }


                        inviteHtml += '<li>' + userInfo + titleHtml + '</li></div>'
                    }

                    if (page == 1) {
                        $('#inviteContent').html(inviteHtml)
                    } else {
                        $('#inviteContent').append(inviteHtml)
                    }


                } else if (type == 4) {
                    //活动
                    var actHtml = '';

                    for (var i = 0; i < listData.length; i++) {
                        var list = listData[i];

                        var contentHtml = '';//活动内容
                        var actStatus = '';//活动状态
                        //顶置，标签，热度
                        var toUp = '';//是否置顶
                        if (list.recommend == 1) {
                            toUp = '<span class="bt-pd toUp">置顶</span>';
                        }
                        var tips = '';//标签
                        if (isDefine(list.cut_list)) {
                            for (var z = 0; z < list.cut_list.length; z++) {
                                tips += '<span class="bt-pd tips">#' + list.cut_list[z] + '#</span>'
                            }
                        }
                        var hotHtml = '';//热度，标签
                        hotHtml = '<div class="detail-bottom" style="height: auto;">' +
                            '              <div class="bottom-tips">' + toUp + tips + '</div>' +
                            // '              <div class="bottom-hot">' + list.hot_number + '</div>' +
                            '          </div>';


                        if (list.status == 1) {
                            actStatus = '<p class="status status1">报名中</p>'
                        } else if (list.status == 2) {
                            actStatus = '<p class="status status3">进行中</p>'
                        } else if (list.status == 3) {
                            actStatus = '<p class="status status2">已结束</p>'
                        } else {
                            actStatus = '<p class="status status2">已取消</p>'
                        }

                        var icon_img = ''
                        if(isDefine(list.icons_path)){
                            icon_img = list.icons_path[0]
                        }else {
                            icon_img = list.background_path;
                        }
                        console.log(list.title)
                        var activity = {'activity_id': list.id};
                        contentHtml = '<div class="flex-div" tapmode onclick=\'commonUrl("../activity/activity_index",' + jsonChange(activity) + ')\'>' +
                            '                    <div class="act-img bg-cover" style="background-image: url(' + ajaxUrl + icon_img + ')"></div>' +
                            '                    <div class="act-info">' +
                            '                        <h6 class="single-ellipsis">' + list.title + '</h6>' +
                            '                        <div class="act-time">' +
                            '                            <p class="time">' + list.week + ' ' + list.start_date + '</p>' + actStatus + '</div>' +
                            '                        <div class="act-place">' +
                            '                            <p class="place">' + list.address + '</p>' +
                            '                            <p class="num">' + list.sum_number + '/' + list.number + '</p>' +
                            '                        </div>' +
                            '                    </div>' +
                            '                </div>';

                        actHtml += '<li style="border-bottom: 1px #f0f0f0 solid;" class="list-li">' + contentHtml + hotHtml + '</li>'
                    }

                    if (page == 1) {
                        $('#actContent').html(actHtml)
                    } else {
                        $('#actContent').append(actHtml)
                    }

                } else if (type == 5) {
                    //用户
                    var userHtml = '';
                    console.log(jsonChange(listData))
                    for (var i = 0; i < listData.length; i++) {
                        var list = listData[i];
                        var badgeList = '';
                        var user = {'member_id': list.id};
                        if (isDefine(list.badge_path)) {
                            for (var k = 0; k < list.badge_path.length; k++) {
                                if (k <= 5) {
                                    badgeList += '<dd class="icon"><img src="' + ajaxUrl + list.badge_path[k] + '" alt=""></dd>'
                                }
                            }
                        }

                        var autograph = ''
                        if(!isDefine(list.autograph) || list.autograph==0){
                            autograph = commonNote;
                        }else {
                            autograph = list.autograph
                        }

                        userHtml += '<li><div class="common-user-detail">' +
                            '           <div class="user-info" tapmode onclick=\'commonUrl("../activity/person_index",' + jsonChange(user) + ')\'>' +
                            '               <div class="user-icon bg-cover" style="background-image: url(' + ajaxUrl + list.icon_path + ');"></div>' +
                            '               <div class="info">' +
                            '                    <div class="name">' +
                            '                        <h6>' + list.name + '</h6>' +
                            '                        <dl class="badge-list" tapmode onclick="toBadgePage(event)">' + badgeList + '</dl>' +
                            '                    </div>' +
                            '                    <span class="time single-ellipsis">' + autograph + '</span>' +
                            '                </div>' +
                            '            </div></div></li>';


                    }

                    if (page == 1) {
                        $('#userContent').html(userHtml)
                    } else {
                        $('#userContent').append(userHtml)
                    }

                }

                page++;
                pullUp = true;

            } else {

                if (type == 1) {
                    if (page == 1) {
                        $('#newsContent').html(noData)
                    } else {
                        $('#newsContent').append('<p style="width: 100%;" class="pt30 pb30 t-c c-999">没有更多了</p>')
                    }

                } else if (type == 2) {
                    if (page == 1) {
                        $('#discussContent').html(noData)
                    } else {
                        $('#discussContent').append('<p style="width: 100%;" class="pt30 pb30 t-c c-999">没有更多了</p>')
                    }

                } else if (type == 3) {
                    if (page == 1) {
                        $('#inviteContent').html(noData)
                    } else {
                        $('#inviteContent').append('<p style="width: 100%;" class="pt30 pb30 t-c c-999">没有更多了</p>')
                    }
                } else if (type == 4) {
                    if (page == 1) {
                        $('#actContent').html(noData)
                    } else {
                        $('#actContent').append('<p style="width: 100%;" class="pt30 pb30 t-c c-999">没有更多了</p>')
                    }

                } else if (type == 5) {
                    if (page == 1) {
                        $('#userContent').html(noData)
                    } else {
                        $('#userContent').append('<p style="width: 100%;" class="pt30 pb30 t-c c-999">没有更多了</p>')
                    }
                }
                pullUp = false;
            }

            //添加监听返回刷新
            api.sendEvent({
                name: 'SearchHistory',
                extra: {}
            });
            pop.close()
            mescroll.endErr()

        }, function (error) {
            pop.notice(error.msg);
            pop.close()
            mescroll.endErr()
        })
    }

    //搜索结果 tab切换
    $(".result-kinds").on('click', 'li', function () {
        var _this = $(this);
        type = _this.attr('data-type');
        _this.addClass('on').siblings('li').removeClass('on');
        $(".result-section .result-view").eq(_this.index()).show().siblings('.result-view').hide();

        //清空数据
        $('#newsContent').html('');
        $('#discussContent').html('');
        $('#inviteContent').html('');
        $('#actContent').html('');
        $('#userContent').html('');

        page = 1;
        getSearchResult()

    })


    //关注、取消关注
    function followAction(stype, pid) {
        var type = 1;//类型：1会员 2圈子
        follow(stype, type, pid, function (res) {
            if (stype == 1) {
                pop.notice('关注成功')
            } else {
                pop.notice('已取消关注')
            }
            setTimeout(function () {
                getSearchResult(type)
            }, 1000)
        })
    }


    //话题投票
    function choose(discuss_id, type, event, that) {
        event.stopPropagation();
        var _this = that;
        var param = {
            token: $api.getStorage('token'),
            discuss_id: discuss_id,
            type: type,
        }
        getAjax(Interface.discuss_vote, param, function (res) {
            var rate = res.data.rate;
            var topicNum = Number($(_this).parents('.topic-vote').attr('data-num')) + 1;
            if (type == 1) {
                //赞成
                $(_this).parents('.topic-vote').hide().siblings('.choose-result').show().find('.result2').hide();
            } else {
                //反对
                $(_this).parents('.topic-vote').hide().siblings('.choose-result').show().find('.result1').hide();
            }
            $(_this).parents('.topic-vote').siblings('.choose-result').find('.line').css({width: rate + '%'});
            $(_this).parents('.topic-vote').siblings('.choose-result').find('.percentage').html(rate + '%');
            $(_this).parents('.topic-vote').siblings('.topic-num').html(topicNum + '人已参与');

            pop.notice(res.msg)
        }, function (error) {
            pop.notice(error.msg)
        })
    }


</script>
